package notes.java.sjms23.s9_memetno;

// 备忘录模式
// 发启人
public class Emp {

    // 基本属性
    private String name;
    private int age;
    private double salary;
    
    public Emp(String name, int age, double salary) {
        this.name = name;
        this.age = age;
        this.salary = salary;
    }

    // 备份
    public EmpMemetno memetno() {
        return new EmpMemetno(this);
    }
    
    // 恢复
    public void recovery(EmpMemetno empMemetno) {
        this.name = empMemetno.getName();
        this.age = empMemetno.getAge();
        this.salary = empMemetno.getSalary();
    }
    
    public String getName() {
        return name;
    }
    
    public void setName(String name) {
        this.name = name;
    }
    
    public int getAge() {
        return age;
    }
    
    public void setAge(int age) {
        this.age = age;
    }
    
    public double getSalary() {
        return salary;
    }
    
    public void setSalary(double salary) {
        this.salary = salary;
    }
    
}
